<?php

class Group {
	private $id;
	private $groupname;
	private $intro;
	private $control;
	private $typeset;
	private $typeset_pub;
	/**
	 * @return unknown
	 */
	public function getControl() {
		return $this->control;
	}
	
	/**
	 * @return unknown
	 */
	public function getGroupname() {
		return $this->groupname;
	}
	
	/**
	 * @return unknown
	 */
	public function getId() {
		return $this->id;
	}
	
	/**
	 * @return unknown
	 */
	public function getIntro() {
		return $this->intro;
	}
	
	/**
	 * @return unknown
	 */
	public function getTypeset() {
		return $this->typeset;
	}
	
	/**
	 * @return unknown
	 */
	public function getTypeset_pub() {
		return $this->typeset_pub;
	}
	
	/**
	 * @param unknown_type $control
	 */
	public function setControl($control) {
		$this->control = $control;
	}
	
	/**
	 * @param unknown_type $groupname
	 */
	public function setGroupname($groupname) {
		$this->groupname = $groupname;
	}
	
	/**
	 * @param unknown_type $id
	 */
	public function setId($id) {
		$this->id = $id;
	}
	
	/**
	 * @param unknown_type $intro
	 */
	public function setIntro($intro) {
		$this->intro = $intro;
	}
	
	/**
	 * @param unknown_type $typeset
	 */
	public function setTypeset($typeset) {
		$this->typeset = $typeset;
	}
	
	/**
	 * @param unknown_type $typeset_pub
	 */
	public function setTypeset_pub($typeset_pub) {
		$this->typeset_pub = $typeset_pub;
	}

	function __construct($jieku) {
		$this->jieku=$jieku;
	}
	public function init($id){
		$this->setId($id);
		$db=$this->jieku->getDB();
		$db->query(JDBTool::select("*","sys_group",array('id'=>$this->getId())));
		$result=$db->next();
		$this->setControl($result[control]);
		$this->setGroupname($result[groupname]);
		$this->setIntro($result[intro]);
		$this->setTypeset($result[typeset]);
		$this->setTypeset_pub($result[typeset_pub]);
	}
	public function delete(){
		$db=$this->jieku->getDB();
		$db->exec(JDBTool::delete("sys_group",array('id'=>$this->getId())));
	}
	public function update(){
		$db=$this->jieku->getDB();
		$db->exec(JDBTool::update("sys_group",array(
			''=>$this->getControl(),
			''=>$this->getGroupname(),
			''=>$this->getIntro(),
			''=>$this->getTypeset(),
			''=>$this->getTypeset_pub()
		),array('id'=>$this->getId())));
	}
	public function insert(){
		$db=$this->jieku->getDB();
		$db->exec(JDBTool::insert("sys_group",array(
			''=>$this->getControl(),
			''=>$this->getGroupname(),
			''=>$this->getIntro(),
			''=>$this->getTypeset(),
			''=>$this->getTypeset_pub()
		)));
		$this->setId($db->insertID());
	}
}
 
?>
